package com.wang.order;

import com.alibaba.fastjson.JSON;
import com.wang.model.UserAddress;
import com.wang.service.IUserService;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.io.IOException;
import java.util.List;

/**
 * @author wangy
 */
@SpringBootApplication
public class OrderApplication {

    public static void main(String[] args) throws InterruptedException, IOException {
//        SpringApplication.run(OrderApplication.class, args);
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"META-INF/spring/dubbo-reference.xml"});
        context.start();

        // 获取远程服务代理
        IUserService userService = (IUserService) context.getBean("userService");

        // 执行远程方法
        List<UserAddress> list = userService.getUserAddressList("world");

        // 显示调用结果
        System.out.println(JSON.toJSONString(list));

        System.in.read(); // 按任意键退出
    }

}
